<template>
  <div class="container">
    <el-container>
      <el-aside width="200px">
        <div class="log" @click="$router.push({path:'/'})">
          <!-- <img class="log_img" src="@/assets/images/index_pic_logoTop2.png" alt=""> -->
          高校社区教务平台
        </div>
        <menuList></menuList>
      </el-aside>
      <el-container>
        <el-header>
          <div></div>
          <el-switch @change="toLogin" v-model="flag" active-text="退出登录">
          </el-switch>
        </el-header>
        <el-main>
          <router-view></router-view>
        </el-main>
      </el-container>
    </el-container>
  </div>
</template>

<script>
import menuList from '@/views/menuList/index.vue'
import { timeouts } from 'retry'
export default {
  components: {
    menuList
  },
  data() {
    return {
      flag: false,
      time: null
    }
  },
  methods: {
    toLogin() {
      if (this.flag) {
        this.$store.commit('user/setUser', {})
        this.time = setTimeout(() => {
          this.$router.push('/login')
        }, 250)
        localStorage.removeItem('erabbit-client-pc-store')
      }
    }
  },
  unmounted() {
    clearTimeout(this.time)
  }
}
</script>

<style lang="less" scoped>
.el-container {
  color: black;
}
.el-header {
  background-color: #ffffff;
  color: #333;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.el-aside {
  background-color: #ffffff;
  color: #333;
  .log {
    height: 60px;
    text-align: center;
    line-height: 60px;
    font-weight: 700;
    font-size: 18px;
    color: black;
    cursor: pointer;
  }
}

.el-main {
  background-color: #ffffff;
  padding: 5px;
  color: #333;
  height: calc(100vh - 60px);
}
</style>>
